package red.mlz.consoleconsumer.feign.article;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import red.mlz.common.entity.article.Article;

import java.math.BigInteger;
import java.util.List;

@FeignClient(name = "article-service")
public interface ArticleFeign {

    @RequestMapping("/article-service/getArticlesForConsole")
    List<Article> getArticlesForConsole(@RequestParam(name = "page") int page,
                                               @RequestParam(name = "pageSize") int pageSize,
                                               @RequestParam(name = "title") String title);

    @RequestMapping("/article-service/getArticlesTotalForConsole")
    int getArticlesTotalForConsole(@RequestParam(name = "title")String title);

    @RequestMapping("/article-service/getById")
    Article articleInfo(@RequestParam(name = "articleId") BigInteger articleId);

    @RequestMapping("/article-service/getById")
    Article getById(@RequestParam(name = "articleId") BigInteger articleId);

    @RequestMapping("/article-service/editArticle")
    BigInteger editArticle(@RequestParam(name = "article") BigInteger articleId,
                                  @RequestParam(name = "relateShopId")BigInteger relateShopId,
                                  @RequestParam(name = "title")String title,
                                  @RequestParam(name = "coverImage")String coverImage,
                                  @RequestParam(name = "tags")String tags,
                                  @RequestParam(name = "content")String content,
                                  @RequestParam(name = "weight")Integer weight);

    @RequestMapping("/article-service/delete")
    void delete(@RequestParam(name = "articleId") BigInteger articleId);
}
